using System.Drawing.Imaging;
using System.IO;

namespace Nuwanda.TfsSpotlight.Views.ChartView
{
    public class ImageFormatDetector
    {
        public ImageFormat Detect(string fileName)
        {
            var extension = Path.GetExtension(fileName);

            switch(extension.ToLower())
            {
                case "png": return ImageFormat.Png;
                case "bmp": return ImageFormat.Bmp;
                case "jpg": return ImageFormat.Jpeg;
                case "emf": return ImageFormat.Emf;
                case "gif": return ImageFormat.Gif;
                case "tif": return ImageFormat.Tiff;

                default:
                    return ImageFormat.Bmp;
            }
        }
    }
}